package com.timothy.chart;

public class CanvasSetting {
	private int bgColor;
	private int canvasHeight;
	private int canvasWidth;
	
	private int leftMargin;
	private int rightMargin;
	private int topMargin;
	private int bottomMargin;
	
	private int spaceInCharts;	//图形之间的间距
	private int countOfCharts;//图形的数量
	private int widthOfCylinder;//柱形的宽度
	
	private int orientation ; 
	
	public CanvasSetting(){

	}
	
	public CanvasSetting(int canvasHeight,int canvasWidth,int color,int orientation){
		this.leftMargin = (int)(canvasWidth/10.0);
		this.rightMargin =(int) (canvasWidth/10.0);
		this.topMargin =(int) (canvasHeight/10.0);
		this.bottomMargin = (int)(canvasHeight/10.0);
		
		//vertical chart
		if(orientation == 1){
			spaceInCharts =  (int)((canvasWidth - leftMargin - rightMargin)/15.0);
//			widthOfCylinder = (int)(1.0*(canvasWidth - leftMargin - rightMargin)/countOfCylinder-spaceInCharts);
		}
		//horizontal chart
		if(orientation == 2){
			spaceInCharts = (int)((canvasHeight - topMargin - bottomMargin)/15.0);
//			widthOfCylinder = (int)((canvasHeight - leftMargin - rightMargin)/countOfCylinder-spaceInCharts);
		}
		
		this.bgColor = color;
	}

	public CanvasSetting(int leftMargin, int rightMargin, int topMargin,
			int bottomMargin, int spaceInCylis, int countOfCylinder) {
		super();
		this.leftMargin = leftMargin;
		this.rightMargin = rightMargin;
		this.topMargin = topMargin;
		this.bottomMargin = bottomMargin;
		this.spaceInCharts = spaceInCylis;
		this.countOfCharts = countOfCylinder;
	}
	
	public int getBgColor() {
		return bgColor;
	}

	public void setBgColor(int bgColor) {
		this.bgColor = bgColor;
	}

	public int getLeftMargin() {
		return leftMargin;
	}

	public void setLeftMargin(int leftMargin) {
		this.leftMargin = leftMargin;
	}

	public int getRightMargin() {
		return rightMargin;
	}

	public void setRightMargin(int rightMargin) {
		this.rightMargin = rightMargin;
	}

	public int getTopMargin() {
		return topMargin;
	}

	public void setTopMargin(int topMargin) {
		this.topMargin = topMargin;
	}

	public int getBottomMargin() {
		return bottomMargin;
	}

	public void setBottomMargin(int bottomMargin) {
		this.bottomMargin = bottomMargin;
	}

	public double getSpaceInCylis() {
		return spaceInCharts;
	}

	public void setSpaceInCylis(int spaceInCylis) {
		this.spaceInCharts = spaceInCylis;
	}

	public int getCountOfCylinder() {
		return countOfCharts;
	}

	public void setCountOfCylinder(int countOfCylinder) {
		this.countOfCharts = countOfCylinder;
	}
	
	public int getWidthOfCylinder() {
		return widthOfCylinder;
	}

	public void setWidthOfCylinder(int widthOfCylinder) {
		this.widthOfCylinder = widthOfCylinder;
	}

	public int getCanvasHeight() {
		return canvasHeight;
	}

	public void setCanvasHeight(int canvasHeight) {
		this.canvasHeight = canvasHeight;
	}

	public int getCanvasWidth() {
		return canvasWidth;
	}

	public void setCanvasWidth(int canvasWidth) {
		this.canvasWidth = canvasWidth;
	}

	public int getOrientation() {
		return orientation;
	}

	public void setOrientation(int orientation) {
		this.orientation = orientation;
	}

	public static CanvasSetting getMockInstance(){
		CanvasSetting canvasSetting = new CanvasSetting();
		canvasSetting.setLeftMargin(50);
		canvasSetting.setRightMargin(50);
		canvasSetting.setTopMargin(50);
		canvasSetting.setBottomMargin(50);
		
		canvasSetting.setSpaceInCylis(20);
		canvasSetting.setCountOfCylinder(2);
		
		return canvasSetting;
	}

}
